<? if(!defined('IN_ROOT')) exit('Access Denied'); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd"><? $user=$this->user; $setting=$this->setting; ?><html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Manyou's Control Panel</title>
        <meta http-equiv="Content-Type" content="text/html; charset=<?=MY_CHARSET?>">
        <link media="all" type="text/css" href="css/common/admin/admincp.css" rel="stylesheet" />
        <script src="js/jquery.js" type="text/javascript"></script>
<script src="js/dialog.js" type="text/javascript"></script>
<script src="js/admin.js" type="text/javascript"></script>
<script src="js/calendar.js" type="text/javascript"></script>
    </head>

    <body>

        <div id="append">
        </div>

        <div class="container">
            <? if(isset($message)) { ?>            <? $type=isset($type)?$type:'correctmsg';  ?>            <div class="<?=$type?>"><p><?=$message?></p></div>
            <? } ?>            <h3>景点列表 <a href="index.php?admin_views/add<?=$setting['seo_suffix']?>" class="sgbtn">添加景点</a></h3>
            <br />
            <div class="hastabmenu">
                <div class="tabcontentcur" id="srchuserdiv">
                    <form action="index.php?admin_views/search<?=$setting['seo_suffix']?>" method="post">
                        <table width="100%">
                            <tr>
                                <td>景点地区:</td>
                                <td><?=$area_js?></td>
                                <td>景点名称:</td>
                                <td><input class="txt" name="viewsname"></td>
                                <td rowspan="2"><input class="btn" type="submit" name="submit" value="提 交"></td>
                            </tr>
                        </table>
                    </form>
                </div>
            </div>
            <br>
            <h4>[共 <?=$viewsnum?> 个景点]</h4>
            <div class="mainbox">
                <form name="userForm" action="index.php?admin_views/remove<?=$setting['seo_suffix']?>" method="post">
                    <table class="datalist fixwidth" >
                        <tr>
                            <th><input class="checkbox" id="chkall" onclick="checkall('gid[]')" type="checkbox" name="chkall"><label for="chkall">全选</label></th>
                            <th>景点名称</th>
                            <th>所属地区</th>
                            <th>门票管理</th>
                            <th>操作</th>
                        </tr>
<? if(is_array($viewslist)) { foreach($viewslist as $views) { ?>
                        <tr>
                            <td class="option"><input class="checkbox" type="checkbox" value="<?=$views['id']?>" name="gid[]"></td>
                            <td><strong><?=$views['name']?></strong></td>
                            <td><?=$views['areaname']?></td>
                            <td><a href="#"  onClick="addticket('<?=$views['id']?>');">添加门票</a>&nbsp;&nbsp;<a href="#" style="color:green" onClick="editticket('<?=$views['id']?>');">管理门票</a><input type="hidden" value="<?=$views['ticket']?>" name="ticket_<?=$views['id']?>" id="ticket_<?=$views['id']?>"></td>
                            <td><a href="index.php?admin_views/edit/<?=$views['id']?><?=$setting['seo_suffix']?>">编辑</a></td>
                        </tr>
<? } } ?>
                        <tr class="nobg">
                            <td colspan="5" class="tdpage"><div class="pages"><?=$departstr?></div></td>
                        </tr>
                        <tr class="nobg">
                            <td colspan="5">&nbsp;&nbsp;<input class="btn" type="button" name="delete" onclick="ondelete();" value="删除" /></td>
                        </tr>

                    </table>
                </form>
            </div>
        </div>

    </body>
    <script type="text/javascript">
        function ondelete(){
            if($("input[name='gid[]']:checked").length == 0){
                alert('你没有选择任何景点!');
                return false;
            }
            if(confirm('确认删除该景点?此操作不可恢复!')==false){
                return false;
            }
            document.userForm.action="index.php?admin_views/remove<?=$setting['seo_suffix']?>";
            document.userForm.submit();
        }
        function editticket(qid){
        	var str = document.getElementById("ticket_"+qid).value;
        	if(str == ''){
        		alert("暂无数据，请添加门票后再编辑");
        		return false;
        	}else{
        		s = '';
        		s1 = str.split("@");
        		for(i=0;i<s1.length;i++){
        			s2 = s1[i].split("|");
        			s = s + '<input type="text" value="'+s2[1]+'" name="tname['+s2[0]+']" size=10>&nbsp;<input type="text" value="'+s2[2]+'" name="tprice['+s2[0]+']" size=5>&nbsp;<input type="text" value="'+s2[3]+'" name="mprice['+s2[0]+']" size=5>&nbsp;<a href="index.php?admin_ticket/delone/'+s2[0]+'/<?=$page?>">删除</a><br />';
        		}
        		$.dialog({
    id:'editticket',
    position:'center',
    align:'left',
    fixed:1,
    width:350,
    height:100,
    title:'编辑门票',
    fnOk:function(){
    	document.getElementById("editticketf").submit();
    	$.dialog.close('editticket')
    },
    fnCancel:function(){$.dialog.close('editticket')},
    content:'<div class="mainbox"><form name="editticketf" id="editticketf"  action="index.php?admin_ticket/editone<?=$setting['seo_suffix']?>" method="post" ><input type="hidden" value="'+qid+'" name="sid"/><input type="hidden" value="<?=$page?>" name="page"/>'+s+'</form></div>'
  });
        	} 
}
function addticket(qid){
$.dialog({
    id:'addticket',
    position:'center',
    align:'left',
    fixed:1,
    width:300,
    height:100,
    title:'添加门票',
    fnOk:function(){
    	if(document.getElementById("tname").value == '' || document.getElementById("price").value == ''){
    		alert("请正确填写门票相关信息！");
    		return false;
    	}
    	document.getElementById("addticketf").submit();
    	$.dialog.close('addticket')
    },
    fnCancel:function(){$.dialog.close('addticket')},
    content:'<div class="mainbox"><form name="addticketf" id="addticketf"  action="index.php?admin_ticket/addone<?=$setting['seo_suffix']?>" method="post" ><input type="hidden" value="'+qid+'" name="sid"/><input type="hidden" value="<?=$page?>" name="page"/>门票名称：<input type="radio" value="成人票" onclick="postv(this.value);">成人&nbsp;<input type="radio" value="儿童票" onclick="postv(this.value);">儿童&nbsp;<input type="radio" value="免票" onclick="postv(this.value);">免票<br /><input type="text" name="tname" value="成人票" class="txt" size="40" id="tname"/><br />门票价格(必须为整数)：<br />市场价：<input type="text" name="price" id="price" value="" class="txt" size="30" /><br />会员价：<input type="text" name="mprice" id="mprice" value="" class="txt" size="30" /></form></div>'
  });
 
}
function postv(v){
document.getElementById("tname").value =v;
}

    </script>
</html>
